<!DOCTYPE html>
<html lang="cn">
<head>
    <title>OOC生成器</title>
    <meta charset="utf-8">
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.js"></script>
    <style>
        label {
            color: rgb(0, 150, 255);
        }

        option {
            font-size: 32px;
        }

        .text textarea {
            height: 500px;
            width: 500px;
            color: rgb(0, 0, 0, 0.95);
            font-weight: 300;
            background-color: rgba(255, 255, 255, 0.95);
        }

        .select {
            margin: 0 auto;
            text-align: center;
            color: #999;
            font-weight: 350;
            font-size: 32px;
        }

        select {
            margin: 4px;
            width: auto;
            height: auto;
            border-radius: 1px;
            font-size: 24px;
            color: #999;
        }

        select:hover {
            transition: 0.75s all;
            color: rgba(0, 0, 0);
            border-radius: 15px;
        }

        .text {
            text-align: center;
            display: flex;
            justify-content: center;
        }

        @media screen and (max-width: 1024px) {
            div {
                font-size: 64px !important;
            }

            .text textarea {
                font-size: 56px !important;
                height: -webkit-fill-available;
                overflow-y: visible !important;
            }

            select {
                font-size: 64px;
            }

            label {
                display: grid !important;
            }

            body {
                background-size: 450% !important;
                background-position: 0px 5px;
                background-position: 50% 0%;
            }
        }

        body {
            background-image: url('https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1577362039&di=ba3704aa988986a08467049a98be0404&imgtype=jpg&er=1&src=http%3A%2F%2Fwww.leewiart.com%2Fuserfiles%2F18573%2F1756b215a1834ac2a831020e54884853_view_720.jpg%3F636823737773863750');
            height: 100%;
            background-size: 100%;
            background-repeat: no-repeat;
        }

        a {
            color: rgb(255, 255, 255, 0.8);
            font-size: 32px;
            font-weight: 600;
            margin: 8px;
        }

        td {
            color: rgb(255, 255, 255, 0.8);
            font-size: 18px;
            font-weight: 600;
        }
    </style>
</head>
<body>
<div class="select">
    <label for="version">请选择版本：</label>
    <select id="version">
        <option value="0">1.13</option>
        <option value="1">1.12</option>
    </select>
    <label for="mode">请选择执行方式：</label>
    <select id="mode">
        <option value="0">脉冲命令方块</option>
        <option value="1">循环命令方块</option>
        <option value="2">命令方块矿车</option>
    </select>
</div>
<div class="text">
    <label for="in"></label>
    <textarea id="in" placeholder="请输入命令"></textarea>
    <label for="out"></label>
    <textarea id="out" placeholder="这里会自动生成ooc"></textarea>
</div>
<div>
    <ul>
        <li><a>11月19日 - 优化</a></li>
        <table>
            <tr>
                <td>优化界面,更加清爽美观，去掉频繁的本地图片使用百度链接加速，优化带空格的的代码一键合并优化到底加速加载!</td>
            </tr>
        </table>
    </ul>
</div>
<script>
    $(function () {
        const c1 = ['/summon falling_block ~ ~2 ~ {BlockState:{Name:"command_block",Properties:{facing:"up"}},TileEntityData:{Command:"",auto:1b},Time:1%}', '/summon falling_block ~ ~2 ~ {BlockState:{Name:"repeating_command_block",Properties:{facing:"up"}},TileEntityData:{Command:"",auto:1b},Time:1%}', '/summon falling_block ~ ~2 ~ {BlockState:{Name:"redstone_block"},Time:1,Passengers:[{id:falling_block,Time:1,BlockState:{Name:"activator_rail"},Time:1}%]}', '/summon falling_block ~ ~2 ~ {Block:command_block,Data:1,TileEntityData:{Command:"",auto:1b},Time:1%}', '/summon falling_block ~ ~2 ~ {Block:repeating_command_block,Data:1,TileEntityData:{Command:"",auto:1b},Time:1%}', '/summon falling_block ~ ~2 ~ {Block:redstone_block,Time:1,Passengers:[{id:falling_block,Time:1,Block:activator_rail,Time:1}%]}'];
        const c2 = [',Passengers:[{id:falling_block,Time:1,auto:1,BlockState:{Name:"command_block",Properties:{facing:"up"}},TileEntityData:{Command:"%c",auto:1b},Time:1%p}]', ',Passengers:[{id:falling_block,Time:1,auto:1,BlockState:{Name:"chain_command_block",Properties:{facing:"up"}},TileEntityData:{Command:"%c",auto:1b},Time:1%p}]', ',{id:command_block_minecart,Command:"%c"}%p', ',Passengers:[{id:falling_block,Time:1,auto:1,Data:1,Block:command_block,TileEntityData:{Command:"%c",auto:1b},Time:1%p}]', ',Passengers:[{id:falling_block,Time:1,auto:1,Data:1,Block:chain_command_block,TileEntityData:{Command:"%c",auto:1b},Time:1%p}]', ',{id:commandblock_minecart,Command:"%c"}%p'];

        function update() {
            let index = $('#version').val() * 3 - -$('#mode').val();
            $('#out').text(c1[index].replace('%', $('#in').val().replace(/[\\"]/g, s => '\\' + s).split('\n').reduceRight((s, com) => {
                return c2[index].replace(/%./g, r => r === '%p' ? s : com);
            }, '')));
        }

        $('.text #in').bind("input propertychange", update);
        $('.select select').change(update);
    }) </script>
</body>
</html>
